'use strict';

const { Service } = require('egg');
const ModelName = 'PvForecastRel'
class RouterService extends Service {
  async allList() {
    return this.ctx.model[ModelName].findAll();
  }

  /**
   * 根据ID修改
   * @param {Object} data 要修改的信息
   */
  async update(data) {
    for (let key in data) {
      await this.ctx.model[ModelName].update({ value: data[key] }, { where: { code: key } });
    }
    return true;
  }
}

module.exports = RouterService;
